import requests

if __name__ == '__main__':
    url = " https://xy112x85x127x74xy2408y873cy7010y1004yy4xy.mcdn.bilivideo.cn:4483/upgcxcode/54/44/30643454454/30643454454-1-30016.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&nbs=1&mid=0&gen=playurlv3&trid=000039132c5fc1fb4679b39bb3e611df622u&os=mcdn&og=hw&deadline=1751111330&uipk=5&oi=614705653&platform=pc&upsig=37e4096572d439da1c12a400bef98e75&uparams=e,nbs,mid,gen,trid,os,og,deadline,uipk,oi,platform&mcdnid=50025925&bvc=vod&nettype=0&bw=67916&buvid=&build=0&dl=0&f=u_0_0&agrr=1&orderid=0,3"
    headers = {
    "Accept": "*/*",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Connection": "keep-alive",
    "If-Range": "\"3a3cedb8438a2ea171ddfb281aa306e6\"",
    "Origin": "https://www.bilibili.com",
    "Range": "bytes=903108-961230",
    "Referer": "https://www.bilibili.com",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "cross-site",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
    "sec-ch-ua": "\"Google Chrome\";v=\"137\", \"Chromium\";v=\"137\", \"Not/A)Brand\";v=\"24\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\""
}
    response = requests.get(url, headers=headers)

    # 打印响应信息
    print(f"Status Code: {response.status_code}")
    print(f"Response Headers: {response.headers}")
    # print(response.text)

    # 如果需要保存响应内容（例如视频片段）
    with open("video_segment.m4s", "wb") as f:
        f.write(response.content)